/**
 * @author phoenics@126com
 * @date 2017年11月7日 上午10:02:06
 * @version V1.0
 */

package com.jx.gocom.nlp;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 *
 */
@SpringBootApplication
@EnableSwagger2
public class Application {
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Application.class);
	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
	
	@Value("${gocom.nlp.python.keyword.service}")
	String pythonService = "";
	@Value("${gocom.nlp.python.keyword.deepService4bayes}")
	String pythonService4 = "";
	 @Bean
	    public Docket createRestApi() {
	        return new Docket(DocumentationType.SWAGGER_2)
	                .apiInfo(new ApiInfoBuilder()
	                        .title("引擎服务 APIs")
	                        .description("")
	                        .version("1.0")
	                        .build())
	                //.pathMapping("/api")
	                .select()
	                .apis(RequestHandlerSelectors.basePackage("com.jx.gocom.nlp.classify.webservice.restcontroller"))
	               .paths(PathSelectors.any())
	                .build();
	    }
	 
	 @Bean
		public RestTemplate restTemplate(RestTemplateBuilder builder) {
			return builder.build();
		}
	 @Bean(name="deepService")
	 public String deepService() {
		 return pythonService;
	 }
	 @Bean(name="deepService4bayes")
	 public String deepService4bayes() {
		 return pythonService4;
	 }
}
